<div id="content">
	<%= render 'administrator/tabs' %>
</div>
<h2>Search audits</h2>
<div class="form-search">
	<%= render 'search' %>
</div>
<h2>Listing audits</h2>
<table class="scaffold-table">
	<tr>
		<th>NO.</th>
		<th>Model</th>
		<th>Action</th>
		<th>User</th>
		<th>Before</th>
		<th>After</th>
		<th>Date/Time</th>
		<th>View</th>
		<th>Edit</th>
		<th>Delete</th>
	</tr>
	<% @audits.each_with_index do |audit , index | %>
	<tr>
		<td><%= index+1 %></td>
		<td><%= audit.model %></td>
		<td><%= audit.action %></td>
		<td><%= audit.user %></td>
		<td><%= audit.before %></td>
		<td><%= audit.after %></td>
		<td><%= audit.created_at %></td>
		
		<td class="command"> <% if can? :read, Audit %>
		<%= link_to image_tag("view-icon.png", :border => 0) , audit  %>
		<% else %>
		-
		<% end %> </td>
		<td class="command"> <% if can? :update, Audit %>
		<%= link_to image_tag("edit-icon.png", :border => 0) , edit_audit_path(audit)  %>
		<% else %>
		-
		<% end %> </td>
		<td class="command"> <% if can? :destroy, Audit %>
		<%= link_to image_tag("delete-icon.png", :border => 0) , audit , :confirm => 'Are you sure?', :method => :delete %>
		<% else %>
		-
		<% end %> </td>
	</tr>
	<% end %>
</table>
<%= will_paginate @audits %>
<% if can? :create , Audit %>
<%= link_to image_tag("add-icon.png", :border => 0) , new_audit_path , {:class => 'form-command'} %>
<%= link_to 'New Audit', new_audit_path %>
<% end %> 
